﻿using UnityEngine;
using System.Collections;

// 跳转点
public class JumpPoint : MonoBehaviour
{
    // 跳转点ID
    public int ID = 1;

    private void Awake()
    {
        var rig = gameObject.AddComponent<Rigidbody>();
        rig.useGravity = false;
        rig.isKinematic = true;

        var collider = gameObject.GetComponent<Collider>();

        collider.isTrigger = true;
    }

    private void OnTriggerEnter(Collider other)
    {
        var mainRole = other.GetComponent<MainRole>();
        if (mainRole == null)
        {
            return;
        }

        mainRole.JumpMap(ID);
    }
}
